export class MoveWidgetFromAToBContainerCommand {
  constructor(oldIdx, newIdx, AContainer, BContainer) {
    this.oldIdx = oldIdx
    this.newIdx = newIdx
    this.AContainer = AContainer
    this.BContainer = BContainer
  }
  execute () {
    // 获取A中的物料，移动到B
    const widget = this.AContainer.widgetList.splice(this.oldIdx, 1)[0]
    this.BContainer.widgetList.splice(this.newIdx, 0 , widget)
  }
  undo() {
    // 获取B中的物料，还给A
    const widget = this.BContainer.widgetList.splice(this.newIdx, 1)[0]
    this.AContainer.widgetList.splice(this.oldIdx, 0, widget)
  }
}